<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>小鱼ADMIN</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="/public/static/css/font.css">
    <link rel="stylesheet" href="/public/static/css/bgadmin.css">
    <script type="text/javascript" src="/public/static/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/public/static/js/bgadmin.js"></script>
	<script type="text/javascript" src="/public/static/js/jquery.form.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <style>
  .layui-input{height:30px;}
  .layui-form-label{line-height: 16px;}
  </style>
  <body>
    <div class="bg-body">
      <div class="layui-row">
        <form class="layui-form ">
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">下单时间从：</label>
              <div class="layui-input-inline">
                <input type="text" class="layui-input" id="start_createtime_id" name="start_createtime">
              </div>
            </div>
            <div class="layui-inline">
              <label class="layui-form-label">到：</label>
              <div class="layui-input-inline">
                <input type="text" class="layui-input" id="end_createtime_id" name="end_createtime">
              </div>
            </div>
            <a class="layui-btn layui-btn-small"  style="margin-bottom: 10px;" id="search"  lay-submit="" lay-filter="search"><i class="layui-icon" >&#xe615;</i></a>
			<a class="layui-btn layui-btn-small"  style="margin-bottom: 10px;" id="export"  lay-submit="" lay-filter="export"><i class="layui-icon" >导出</i></a>
        </div>
		</form>
	  </div>

      <table class="layui-table" lay-data="{id: 'reportId', height:500, url:'/index.php/crm/Salereport/goodsSaleReportData', page:true, limit:10, limits:[10,20,30,50]}" lay-filter="demo">
        <thead>
        <tr>
          <th lay-data="{field:'good_num', width:150, align:'center',sort:true}">商品货号</th>
          <th lay-data="{field:'good_name', width:150, align:'center',sort:true}">商品名称</th>
          <th lay-data="{field:'total_good_sales_num', width:150, align:'center',sort:true}">总销售个数</th>
          <th lay-data="{field:'total_good_sales_money', width:150, align:'center',sort:true}">总销售金额</th>
          <th lay-data="{field:'actual_good_sales_num', width:120, align:'center',sort:true}">实际销售个数</th>
          <th lay-data="{field:'actual_good_sales_money', width:120, align:'center',sort:true}">实际销售金额</th>
          <th lay-data="{field:'other_good_sales_num', width:120, align:'center',sort:true}">其他销售个数</th>
          <th lay-data="{field:'other_good_sales_money', width:120, align:'center',sort:true}">其他销售金额</th>
        </tr>
        </thead>
      </table>
    </div>
</body>
<script type="text/javascript">
layui.use(['layer', 'form','table'], function(){
  var layer = layui.layer
  ,form = layui.form
  ,table = layui.table;
  //重载数据表
  $('#search').click(function(){
      var start_createtime = $("#start_createtime_id").val();
      var end_createtime = $("#end_createtime_id").val();
	  table.reload('reportId', {
        url: 'goodsSaleReportData'
        ,where: {
          createtime_start : start_createtime
          ,createtime_end : end_createtime  
        } //设定异步数据接口的额外参数
      });
  }); 
  
  table.render({ //其它参数在此省略
	  done: function(res, curr, count){
		//如果是异步请求数据方式，res即为你接口返回的信息。
		//如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
		
		//得到数据总量
		alert(count);
	  }
	});
});


layui.use('laydate', function(){
	var laydate = layui.laydate;
	laydate.render({
		elem: '#start_createtime_id'
		,type: 'datetime'
	});

	laydate.render({
		elem: '#end_createtime_id'
		,type: 'datetime'
	});
});


</script>
</html>